import java.util.Arrays;

public class Solution274 {
    public int hIndex(int[] citations) {
        Arrays.sort(citations);
        int ans=0;
        for (int i=citations.length-1;i>=0;i--){
            if (citations[i]>=citations.length-i){
                ans++;
            }
        }
        return ans;
    }

    public static void main(String[] args) {
        System.out.println(new Solution274().hIndex(new int[]{3,0,6,1,5}));
    }
}
